﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="CheckPlan.aspx.vb" Inherits="_CheckPlan" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %>
<%@ Register Assembly="ISNet.WebUI.WebDesktop" Namespace="ISNet.WebUI.WebDesktop" TagPrefix="ISWebDesktop" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
       <script src="script/tinybox.js"></script>
    <link href="script/style.css" rel="stylesheet" />
    <script>
        function WebGrid1_OnRowContextMenu(controlId, rowType, rowElement, menuObject) {
            menuObject.Items[0].Hide();

            return false;
        }
        //function CancelRelease(Fund,version) {
         
        //    if (confirm('กรุณายืนยัน  "ยกเลิกการส่งแผน" \nหน่วยงาน ' + Fund + ' จะสามารถแก้ไขข้อมูลแผนได้อีกครั้ง') == false) {
        //        return false
        //    }
        //    //alert(id); return;
        //    var grid = ISGetObject("WebGrid1");
        //    var data = Fund + "," + version;
        //    grid.AddInput("data", data);
        //    grid.SendCustomRequest();



        //    event.cancelBubble = true;
        //    event.returnValue = false;

        //}

    </script>
    <script type="text/javascript">
        function popupwait() {
            TINY.box.show({ iframe: 'loading.html', boxid: 'frameless', close: 0, width: 300, height: 260, fixed: false, maskid: 'lightmask', maskopacity: 40, closejs: function () { closeJS() } });
            return false;
        }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager runat="server"></asp:ScriptManager>
    <asp:HiddenField ID="HdMyVersion" runat="server" />
     <br /> 
    <center>
  <div style=" width: 1200px; border: solid; border-color: gray; border-width: 1px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; box-shadow: 5px 5px 5px #808080; text-align: right; padding: 5px 5px 5px 5px;">
            <div style="text-align: right; margin-top: 5px;">
                  <div align="left" style="width: 500px; float: left">
                    <asp:Label ID="Label1" runat="server" Text="ระบบจัดทำงบประมาณ >> จัดทำงบประมาณ >> ตรวจสอบแผน"></asp:Label>
                </div>
                ปี&nbsp;
            <asp:TextBox ID="PlanYearsTxt" runat="server" Width="50px" Enabled="false" Style="text-align: center;"></asp:TextBox>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:ImageButton ID="CheckBtn" runat="server" ToolTip="ตรวจสอบแผน" ImageUrl="Images/planIc/checkPlan.png" OnClientClick="popupwait();"  />
                &nbsp;&nbsp;<asp:ImageButton ID="SendBtn" ToolTip="ส่งแผน" runat="server" ImageUrl="Images/planIc/send.png" Style="height: 21px" OnClientClick="popupwait();" />
                &nbsp;
            </div>
        </div>
</center>
      <br />
   <table style="width:100%;"><tr><td align="center">
    <div  id="div1" runat="server" style="text-align:left; width: 1200px; border: solid; border-color: gray; border-width: 1px;  -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; box-shadow: 5px 5px 5px #808080; ">

                <%--<div style="padding-bottom: 5px;"><strong>&nbsp;</strong></div>--%>
        <br />

                <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1" Width="100%" EnableTheming="True">
                    <asp:TabPanel ID="TabPanel1" runat="server" HeaderText="สถานะการส่งแผน">
                        <ContentTemplate>
                <ISWebGrid:WebGrid ID="WebGrid1" runat="server" UseDefaultStyle="True" Width="100%" DefaultStyleMode="Silver"  Height="400px" >
                    <LayoutSettings AllowAddNew="No" EditOnClick="false" AllowColumnMove="No"
                        AllowEdit="No" AllowDelete="Yes" AllowSorting="Yes" ColumnFooters="Yes" 
                        ResetNewRowValuesOnError="False" InProgressUIBehavior="ChangeCursorToHourGlass"
                        AlwaysShowHelpButton="false" PagingMode="ClassicPaging" PagingSize="10" ColumnFooterAggregateMode="CalculateAllData"
                        VirtualLoadMode="LargeData" AllowGrouping="Yes">
                        <RowStyle Font-Names="Tahoma" Font-Size="9"  CustomRules="overflow: hidden;" />
                        <AlternatingRowStyle Font-Names="Tahoma" Font-Size="9" BackColor="#fbfbfb"  CustomRules="overflow: hidden;" />
                        <ClientSideEvents OnRowValidate="WebGrid1_OnRowValidate"   OnRowContextMenu="WebGrid1_OnRowContextMenu"  />
                    </LayoutSettings>
                    <RootTable DataKeyField="FundCenterCode" NewRowInfoText="เพิ่มรายการ">
                        <Columns>
                         <ISWebGrid:WebGridColumn Caption="FundCenter"  ColumnType="Template" Name="FundCenter" Width="350px">
                                <CellTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='' Font-Bold="True" Font-Size="Medium"></asp:Label>
                                    <asp:Image ID="Image1" runat="server" Width="16px" Height="16px" />
                                 <asp:Label ID="Label1" runat="server" Text='<%# Bind("FundCenterName")%>'></asp:Label>

                                </CellTemplate>
                            </ISWebGrid:WebGridColumn>
                       <ISWebGrid:WebGridColumn Name="version" Width="150px" DataMember="Now_version"  Caption="version" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Center" />
                            </ISWebGrid:WebGridColumn> 
                            <ISWebGrid:WebGridColumn Name="CreateDate" DataMember="CreateDate"  Width="300px" Caption="วันที่ล่าสุด" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Center" />
                            </ISWebGrid:WebGridColumn>
                           
                         
                        </Columns>
                    </RootTable>
                   
                </ISWebGrid:WebGrid>
                        </ContentTemplate>
                    </asp:TabPanel>
                    <asp:TabPanel ID="TabPanel2" runat="server" HeaderText="ผลการทำงาน" Visible="False">
                        <ContentTemplate>
                            <div><strong>รายการครุภัณฑ์ที่ยังมีข้อผิดพลาด</strong></div>
                          <div style="clear:both;">  <ISWebGrid:WebGrid ID="WebGrid2" runat="server" UseDefaultStyle="True" Width="100%" DefaultStyleMode="Silver"  Height="200px" >
                    <LayoutSettings AllowDelete="Yes" AllowSorting="Yes" ColumnFooters="Yes" 
                        ResetNewRowValuesOnError="False" InProgressUIBehavior="ChangeCursorToHourGlass"
                        AlwaysShowHelpButton="False" PagingMode="ClassicPaging" PagingSize="10" 
                        VirtualLoadMode="LargeData" AllowGrouping="Yes" VirtualPageSize="10">
                        <RowStyle Font-Names="Tahoma" Font-Size="9pt"  CustomRules="overflow: hidden;" />
                        <AlternatingRowStyle Font-Names="Tahoma" Font-Size="9pt" BackColor="#FBFBFB"  CustomRules="overflow: hidden;" />
                        <ClientSideEvents OnRowValidate="WebGrid1_OnRowValidate" OnRowContextMenu="WebGrid1_OnRowContextMenu"  />
                    </LayoutSettings>
                    <RootTable DataKeyField="FundCenterCode" NewRowInfoText="เพิ่มรายการ">
                        <Columns>
                          <ISWebGrid:WebGridColumn Caption="Fund Center" Name="FundCenter" DataMember="FundCenterCode" Width="150px" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left" />
                                <ValueList DataTextField="Description" DataSourceID="FundCenterDataSource"
                                    DataValueField="FundCenter_FundCenterCode">
                                </ValueList>
                            </ISWebGrid:WebGridColumn>
                              <ISWebGrid:WebGridColumn Name="Cmmt" Width="150px" Caption="รายการ" DataMember="CmmtCode" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left" />
                                <ValueList DataTextField="Description" DataSourceID="CmmtDataSource"
                                    DataValueField="CmmtCode">
                                </ValueList>
                            </ISWebGrid:WebGridColumn>
                             <ISWebGrid:WebGridColumn Name="Project" Width="150px" Caption="โครงการ" DataMember="Project_ProjectCode" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left" />
                                <ValueList DataTextField="Description" DataSourceID="ProjectDataSource"
                                    DataValueField="Project_ProjectCode">
                                </ValueList>
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Name="ActivityType" Width="250px" Caption="ครุภัณฑ์" DataMember="ActivityTypeCode" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left" />
                                <ValueList DataTextField="Description" DataSourceID="ActivityTypeDataSource"
                                    DataValueField="ActivityTypeCode">
                                </ValueList>
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Name="NewQuantity" DataMember="NewQuantity"  DataFormatString="##,##0"   Width="50px" Caption="ซื้อเพิ่ม" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Right" />
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Name="ReplaceQuantity" DataMember="ReplaceQuantity"  Width="50px"  DataFormatString="##,##0"  Caption="ทดแทน" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Right" />
                            </ISWebGrid:WebGridColumn>
                              <ISWebGrid:WebGridColumn Name="Amount" Width="100px" DataMember="Amount"  DataFormatString="##,##0.00" Caption="จำนวนเงิน" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Right" />
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Name="err" DataMember="err"  Width="350px" Caption="ข้อผิดพลาด" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left" />
                            </ISWebGrid:WebGridColumn>
                           
                         
                        </Columns>
                    </RootTable>
                   
                </ISWebGrid:WebGrid>
                            </div>
                             <div style="margin-top:20px;"><strong>รายการงบประมาณอื่นๆ (ที่ไม่ใช่ครุภัณฑ์)</strong></div>
                            <div style="clear:both;">
                            <ISWebGrid:WebGrid ID="WebGrid3" runat="server" UseDefaultStyle="True" Width="100%" DefaultStyleMode="Silver"  Height="200px" >
                    <LayoutSettings AllowDelete="Yes" AllowSorting="Yes" ColumnFooters="Yes" 
                        ResetNewRowValuesOnError="False" InProgressUIBehavior="ChangeCursorToHourGlass"
                        AlwaysShowHelpButton="False" PagingMode="ClassicPaging" PagingSize="10" 
                        VirtualLoadMode="LargeData" AllowGrouping="Yes" VirtualPageSize="10">
                        <RowStyle Font-Names="Tahoma" Font-Size="9pt"  CustomRules="overflow: hidden;" />
                        <AlternatingRowStyle Font-Names="Tahoma" Font-Size="9pt" BackColor="#FBFBFB"  CustomRules="overflow: hidden;" />
                        <ClientSideEvents OnRowValidate="WebGrid1_OnRowValidate" OnRowContextMenu="WebGrid1_OnRowContextMenu"  />
                    </LayoutSettings>
                    <RootTable DataKeyField="FundCenterCode" NewRowInfoText="เพิ่มรายการ">
                        <Columns>
                         <ISWebGrid:WebGridColumn Caption="Fund Center" Name="FundCenter" DataMember="FundCenterCode" Width="150px" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left"  />
                                <ValueList DataTextField="Description" DataSourceID="FundCenterDataSource"
                                    DataValueField="FundCenter_FundCenterCode">
                                </ValueList>
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Name="CmmtItem" Width="150px" Caption="รายการ" DataMember="CmmtDetail_Id" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left" />
                                <ValueList DataTextField="Description" DataSourceID="CmmtDetailDataSource"
                                    DataValueField="CmmtDetail_Id">
                                </ValueList>
                            </ISWebGrid:WebGridColumn>
                              <ISWebGrid:WebGridColumn Name="Cmmt" Width="150px" Caption="CommitmentItem" DataMember="CmmtCode" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left" />
                                <ValueList DataTextField="Description" DataSourceID="CmmtDataSource"
                                    DataValueField="CmmtCode">
                                </ValueList>
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Name="Product" Width="150px" Caption="ผลิตภัณฑ์" DataMember="Product_ProductCode" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left" />
                                <ValueList DataTextField="Description" DataSourceID="ProductDataSource"
                                    DataValueField="ProductCode">
                                </ValueList>
                            </ISWebGrid:WebGridColumn>
                              <ISWebGrid:WebGridColumn Name="Project" Width="150px" Caption="โครงการ" DataMember="Project_ProjectCode" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left" />
                                <ValueList DataTextField="Description" DataSourceID="ProjectDataSource"
                                    DataValueField="Project_ProjectCode">
                                </ValueList>
                            </ISWebGrid:WebGridColumn>
                          <ISWebGrid:WebGridColumn Name="Activity" Width="150px" Caption="กิจกรรม" DataMember="Activity_ActivityCode" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left" />
                                <ValueList DataTextField="Description" DataSourceID="ActivityDataSource"
                                    DataValueField="Activity_ActivityCode">
                                </ValueList>
                            </ISWebGrid:WebGridColumn>                          
                              <ISWebGrid:WebGridColumn Name="Amount" Width="100px" DataMember="Amount"  DataFormatString="##,##0.00" Caption="จำนวนเงิน" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Right" />
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Name="err" DataMember="err"  Width="400px" Caption="ข้อผิดพลาด" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Left" />
                            </ISWebGrid:WebGridColumn>
                           
                         
                        </Columns>
                    </RootTable>
                   
                </ISWebGrid:WebGrid>
</div> <div style="margin-top:20px;"></div>
                        </ContentTemplate>
                    </asp:TabPanel>
                </asp:TabContainer>
            </div>

 </td></tr></table>
       <asp:ObjectDataSource ID="FundCenterDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="BasicDataTableAdapters.FCTR_ValueTableAdapter">
        <SelectParameters>
            <asp:SessionParameter Name="PlanYear" SessionField="PlanYear" Type="Int16" />
        </SelectParameters>
    </asp:ObjectDataSource>
  <asp:ObjectDataSource ID="ProjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="BasicDataTableAdapters.Project_ValueTableAdapter">
        <SelectParameters>
            <asp:SessionParameter Name="PlanYear" SessionField="PlanYear" Type="Int16" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="CmmtDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="MassChangeDSTableAdapters.CmmtsTableAdapter">
        <SelectParameters>
            <asp:SessionParameter Name="planyear" SessionField="PlanYear" Type="Int16" />
        </SelectParameters>
    </asp:ObjectDataSource>

    <asp:ObjectDataSource ID="ActivityTypeDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="MassChangeDSTableAdapters.ActivityTypesTableAdapter" DeleteMethod="Delete" InsertMethod="Insert" UpdateMethod="Update">
        <SelectParameters>
            <asp:SessionParameter Name="planyear" SessionField="PlanYear" Type="Int16" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="CmmtDetailDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="MsinchuaTableAdapters.CmmtDetails_Value2TableAdapter">
        <SelectParameters>
            <asp:SessionParameter Name="PlanYear" SessionField="PlanYear" Type="Int16" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ProductDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="BasicDataTableAdapters.ProductsTableAdapter">
        <SelectParameters>
            <asp:SessionParameter Name="PlanYear" SessionField="PlanYear" Type="Int16" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ActivityDataSource" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="BasicDataTableAdapters.Activity_ValueTableAdapter">
        <SelectParameters>
            <asp:SessionParameter Name="PlanYear" SessionField="PlanYear" Type="Int16" />
        </SelectParameters>
    </asp:ObjectDataSource>
    
     <%=AlertText %>
    <%=ScriptText %>
</asp:Content>

